package First;

class A
	{
	private int privateA = 10;
	public int publicA = 20;
	protected int protectedA = 30;
	int defaultA = 40;
	
	void showA()
		{
		System.out.println("IN Class A");
		System.out.println(privateA);
		System.out.println(publicA);
		System.out.println(protectedA);
		System.out.println(defaultA);
		}
	
	public static void main(String[] args)
		{
		A FirstClass = new A();
		FirstClass.showA();
		
		B ClassTwo = new B();
		ClassTwo.showBeA();
		ClassTwo.showA();
		
		C ClassThree = new C();
		ClassThree.showC();
		//ClassThree.showBeA(); =>ClassThree doesnot recognize showBeA() 
		//ClassThree.showA(); =>ClassThree doesnot recognize showA()
		}
	}
	
class B extends A
	{
	void showBeA()
		{
		System.out.println("IN Class BeA");
		//System.out.println(privateA); => cannot access the private member of class A
		System.out.println(publicA);
		System.out.println(protectedA);
		System.out.println(defaultA);
		}
	}
	
	
class C
	{
	void showC()
		{
		A ObjAinC = new A();
		System.out.println("In Class C");
		//System.out.println(privateA); => should not be able to access the private members of class A
		//System.out.println(publicA); => you cannot directly access the public member of class A
		System.out.println(ObjAinC.publicA);
		//System.out.println(protectedA); => you cannot directly access the protected members of class A
		System.out.println(ObjAinC.protectedA);
		System.out.println(ObjAinC.defaultA);
		System.out.println("Accessing a method in A using ObjAinC object of class A");
		ObjAinC.showA();
		}
	}

